//
//  DateSelectPicker.h
//  OA-JZD
//
//  Created by apple on 2018/2/1.
//  Copyright © 2018年 JC. All rights reserved.
//

#import <UIKit/UIKit.h>

NS_ASSUME_NONNULL_BEGIN

typedef void (^DateSelectPickerCancelBlock)(void);
typedef void (^DateSelectPickerConfirmBlock)(NSDate *selectdate);

@interface DateSelectPickerComponentObject : NSObject

@property (nonatomic, strong, nullable) NSMutableArray<DateSelectPickerComponentObject *> *subArray;
@property (nonatomic, copy) NSString *text;

- (instancetype)initWithText:(NSString *)text subArray:(NSMutableArray *)array;
- (instancetype)initWithText:(NSString *)text;
@end


@interface DateSelectPickerBuilder : NSObject
//是否显示背后遮罩，默认为YES
@property (nonatomic, assign, getter=isShowMask) BOOL showMask;
//中间提示的文字，默认为“”
@property (nonatomic, copy, nullable) NSString *titleText;
//确认按钮的文字，默认为“确认”
@property (nonatomic, copy, nullable) NSString *confirmText;
//取消按钮的文字，默认为“取消”
@property (nonatomic, copy, nullable) NSString *cancelText;
//确认文字的颜色，默认是蓝色
@property (nonatomic, strong, nullable) UIColor *confirmTextColor;
//取消文字的颜色，默认为蓝色
@property (nonatomic, strong, nullable) UIColor *cancelTextColor;
//选择器的背景颜色，默认为白色
@property (nonatomic, strong, nullable) UIColor *pickerColor;
//选择器的文字颜色，默认为黑色
@property (nonatomic, strong, nullable) UIColor *pickerTextColor;
//默认滚动的行数，默认为第1行
@property (nonatomic, assign) NSInteger defaultIndex;
//整个pickerView的高度，默认为248，包括44的按钮栏
@property (nonatomic, assign) CGFloat pickerHeight;
//最小日期
@property (nonatomic, assign) NSDate *minDate;
//最大日期
@property (nonatomic, assign) NSDate *maxDate;
//选择日期
@property (nonatomic, assign) NSDate *lastSelectDate;
//时间模式
@property (nonatomic) UIDatePickerMode datePickerMode;


@end


@interface DateSelectPicker : UIView
/**
 年月日三级  多行联动数据
 
 @param view 所在的view
 @param builder 配置
 @param components 传入componetobject数组，可嵌套
 @param confirmBlock 点击确认后
 @param cancelBlcok 点击取消后
 */
+ (void)showDatePickerInView:(UIView *)view
                withBuilder:(nullable DateSelectPickerBuilder *)builder
                    confirm:(DateSelectPickerConfirmBlock)confirmBlock
                     cancel:(DateSelectPickerCancelBlock)cancelBlcok;
@end

NS_ASSUME_NONNULL_END
